package com.colin.aiyi.dao.ImpxUtils3_de;

import com.colin.aiyi.app.Constant;
import com.colin.aiyi.entity.response.YiJuAndYiShuoResponse;
import com.colin.aiyi.presenter.Interface.Callback;

import org.xutils.http.RequestParams;

/**
 * Created by hl on 2017/5/8.
 */
@Deprecated
public class ImpSay extends AbsServicexUtils<YiJuAndYiShuoResponse>{

    @Override
    public void onSuccess(String result) {
      super.onSuccess(result);
        YiJuAndYiShuoResponse yiJuAndYiShuoResponse=gson.fromJson(result,YiJuAndYiShuoResponse.class);
       callback.onSuccess(yiJuAndYiShuoResponse);
    }

    @Override
    public void getSayList(Callback callback, String... value) {
        super.getSayList(callback, value);
        if (value.length<1)
        {
            return;
        }
//        1:人气 2：最新  3已购买 4我观看的,5我收藏的
        switch (value[value.length-1])
        {
            case Constant.TAB_TYPE_SAY_HOT:
                getHotList( value);
                break;
            case Constant.TAB_TYPE_SAY_NEW:
                getNewList( value);
                break;

            case Constant.TAB_TYPE_SAY_VIP:
                getVipList( value);
                break;
            case Constant.TAB_TYPE_SAY_WACTH:
                getWatchList( value);
                break;
            case Constant.TAB_TYPE_SAY_LIKE:
                getLikeList( value);
                break;
        }
    }

    /**************************************************************************************/


    public void getNewList( String... parameter) {
        getHotList(parameter);
    }


    public void getHotList(String... parameter) {

        RequestParams params=new RequestParams(Constant.SAY_list);
        params.addBodyParameter("pageSize",Constant.PAGESIZE+"");
        params.addBodyParameter("pageNum",parameter[0]);
        if (parameter.length<2)
        {
            params.addBodyParameter("title","");
        }else {
            params.addBodyParameter("title",parameter[1]);
        }
        params.addBodyParameter("orderType",parameter[parameter.length-1]);
        sendToServer(params);
    }


    public void getVipList(String... parameter) {
        RequestParams params=new RequestParams(Constant.SAY_vipList);
        params.addBodyParameter("pageSize",Constant.PAGESIZE+"");
        params.addBodyParameter("pageNum",parameter[0]);
        params.addBodyParameter("title",parameter[1]);
        sendToServer(params);
    }


    public void getWatchList( String... parameter) {
        RequestParams params=new RequestParams(Constant.SAY_watchList);
        params.addBodyParameter("pageSize",Constant.PAGESIZE+"");
        params.addBodyParameter("pageNum",parameter[0]);
      //  params.addBodyParameter("title",parameter[1]);
        sendToServer(params);
    }


    public void getLikeList(String... parameter) {
        RequestParams params=new RequestParams(Constant.SAY_sayLikeList);
        params.addBodyParameter("pageSize",Constant.PAGESIZE+"");
        params.addBodyParameter("pageNum",parameter[0]);
        params.addBodyParameter("title",parameter[1]);
        sendToServer(params);
    }
}
